package br.com.felix.fwt.svg.pattern;

import java.util.ArrayList;
import java.util.List;

import br.com.felix.fwt.svg.SVG;
import br.com.felix.fwt.svg.SVGBuilder;
import br.com.felix.fwt.svg.SVGId;
import br.com.felix.fwt.svg.SVGViewBox;
import br.com.felix.fwt.svg.transform.SVGTransform;

public class SVGPattern implements SVG{

	private SVGId id;
	private SVGPatternUnits patternUnits;
	private SVGPatternContentUnits patternContentUnits;
	private SVGTransform patternTransform;
	private int x, y, width, height;
	private String xlinkHref;
	private SVGViewBox viewBox;
	private List<SVG>shapes;
	
	public SVGPattern(){
		shapes = new ArrayList<SVG>();
	}
	
	
	public void addShape(SVG shape){
		shapes.add(shape);
	}


	@Override
	public void toSVG(SVGBuilder svgBuilder) {
		svgBuilder.createElement("pattern")
			.id(id)
			.x(x)
			.y(y)
			.width(width)
			.height(height)
			.xlinkHref(xlinkHref)
			.attribute("patternUnits", patternUnits)
			.attribute("patternContentUnits", patternContentUnits)
			.attribute("patternTransform", patternTransform)
			.attribute("viewBox", viewBox)
			.bodyWithChildren(shapes)
			.endElement();
	}
}
